﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:System.Windows.BidiControls;assembly=BidiControls"
    xmlns:primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows"    
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    >
  <ControlTemplate x:Key="ValidationToolTipTemplate">
    <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="OpenStates">
          <VisualStateGroup.Transitions>
            <VisualTransition GeneratedDuration="0"/>
            <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
              <Storyboard>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform" Storyboard.TargetProperty="X">
                  <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                  <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
              </Storyboard>
            </VisualTransition>
          </VisualStateGroup.Transitions>
          <VisualState x:Name="Closed">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
          <VisualState x:Name="Open">
            <Storyboard>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xform" Storyboard.TargetProperty="X">
                <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
              </DoubleAnimationUsingKeyFrames>
              <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity">
                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
              </DoubleAnimationUsingKeyFrames>
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Grid.RenderTransform>
        <TranslateTransform x:Name="xform" X="-25"/>
      </Grid.RenderTransform>
      <Border Margin="4,4,-4,-4" Background="#052A2E31" CornerRadius="5"/>
      <Border Margin="3,3,-3,-3" Background="#152A2E31" CornerRadius="4"/>
      <Border Margin="2,2,-2,-2" Background="#252A2E31" CornerRadius="3"/>
      <Border Margin="1,1,-1,-1" Background="#352A2E31" CornerRadius="2"/>
      <Border Background="#FFDC000C" CornerRadius="2"/>
      <Border CornerRadius="2">
        <TextBlock Margin="8,4,8,4" MaxWidth="250" UseLayoutRounding="false" Foreground="White" Text="{Binding (Validation.Errors)[0].ErrorContent}" TextWrapping="Wrap"/>
      </Border>
    </Grid>
  </ControlTemplate>

  <Style TargetType="local:TextBlock">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:TextBlock">
          <TextBlock 
                        FontFamily="{TemplateBinding FontFamily}"
                        FontSize="{TemplateBinding FontSize}"
                        FontStretch="{TemplateBinding FontStretch}"
                        FontStyle="{TemplateBinding FontStyle}"
                        FontWeight="{TemplateBinding FontWeight}"
                        Foreground="{TemplateBinding Foreground}"
                        LineHeight="{TemplateBinding LineHeight}"
                        LineStackingStrategy="{TemplateBinding LineStackingStrategy}"
                        Padding="{TemplateBinding Padding}"
                        TextAlignment="{TemplateBinding TextAlignment}"
                        TextDecorations="{TemplateBinding TextDecorations}"
                        TextWrapping="{TemplateBinding TextWrapping}"                        
                        Cursor="{TemplateBinding Cursor}"
                        Text="{TemplateBinding LocalText}"
                        x:Name="TextElement"
                        />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="local:TextBox">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:TextBox">
          <TextBox
                        AcceptsReturn="{TemplateBinding AcceptsReturn}"
                        Background="{TemplateBinding Background}"
                        Foreground="{TemplateBinding Foreground}"
                        FontFamily="{TemplateBinding FontFamily}"
                        FontSize="{TemplateBinding FontSize}"
                        FontStretch="{TemplateBinding FontStretch}"
                        FontStyle="{TemplateBinding FontStyle}"
                        FontWeight="{TemplateBinding FontWeight}"                        
                        IsReadOnly="{TemplateBinding IsReadOnly}"
                        MaxLength="{TemplateBinding MaxLength}"
                        SelectionBackground="{TemplateBinding SelectionBackground}"
                        SelectionForeground="{TemplateBinding SelectionForeground}"
                        TextAlignment="{TemplateBinding TextAlignment}"
                        TextWrapping="{TemplateBinding TextWrapping}"
                        Cursor="{TemplateBinding Cursor}"
                        x:Name="TextElement"
                        />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="local:ContentControl">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:ContentControl">
          <ContentControl
                        ContentTemplate="{TemplateBinding ContentTemplate}"
                        IsEnabled="{TemplateBinding IsEnabled}"                        
                        Content="{TemplateBinding LocalContent}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Clip="{TemplateBinding Clip}"
                        Cursor="{TemplateBinding Cursor}"
                        FontFamily="{TemplateBinding FontFamily}"
                        FontSize="{TemplateBinding FontSize}"
                        FontStretch="{TemplateBinding FontStretch}"
                        FontStyle="{TemplateBinding FontStyle}"
                        FontWeight="{TemplateBinding FontWeight}"
                        Foreground="{TemplateBinding Foreground}"
                        Height="{TemplateBinding Height}"
                        Width="{TemplateBinding Width}"
                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                        x:Name="ContentElement"
                        />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="local:Button">
    <Setter Property="Background" Value="#FF1F3B53"/>
    <Setter Property="Foreground" Value="#FF000000"/>
    <Setter Property="Padding" Value="3"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="BorderBrush">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FFA3AEB9" Offset="0"/>
          <GradientStop Color="#FF8399A9" Offset="0.375"/>
          <GradientStop Color="#FF718597" Offset="0.375"/>
          <GradientStop Color="#FF617584" Offset="1"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:Button">
          <!--<Grid>
            <vsm:VisualStateManager.VisualStateGroups>
              <vsm:VisualStateGroup x:Name="CommonStates">
                <vsm:VisualState x:Name="Normal"/>
                <vsm:VisualState x:Name="MouseOver">
                  <Storyboard>
                    <DoubleAnimation Duration="0" Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity" To="1"/>
                    <ColorAnimation Duration="0" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" To="#F2FFFFFF"/>
                    <ColorAnimation Duration="0" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" To="#CCFFFFFF"/>
                    <ColorAnimation Duration="0" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" To="#7FFFFFFF"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Pressed">
                  <Storyboard>
                    <ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#FF6DBDD1"/>
                    <DoubleAnimation Duration="0" Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity" To="1"/>
                    <ColorAnimation Duration="0" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" To="#D8FFFFFF"/>
                    <ColorAnimation Duration="0" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" To="#C6FFFFFF"/>
                    <ColorAnimation Duration="0" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" To="#8CFFFFFF"/>
                    <ColorAnimation Duration="0" Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" To="#3FFFFFFF"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity" To=".55"/>
                  </Storyboard>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
              <vsm:VisualStateGroup x:Name="FocusStates">
                <vsm:VisualState x:Name="Focused">
                  <Storyboard>
                    <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity" To="1"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Unfocused" />
              </vsm:VisualStateGroup>
            </vsm:VisualStateManager.VisualStateGroups>
            <Border x:Name="Background" CornerRadius="3" Background="White" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
              <Grid Background="{TemplateBinding Background}"  Margin="1">
                <Border Opacity="0"  x:Name="BackgroundAnimation" Background="#FF448DCA" />
                <Rectangle x:Name="BackgroundGradient" >
                  <Rectangle.Fill>
                    <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                      <GradientStop Color="#FFFFFFFF" Offset="0" />
                      <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                      <GradientStop Color="#E5FFFFFF" Offset="0.625" />
                      <GradientStop Color="#C6FFFFFF" Offset="1" />
                    </LinearGradientBrush>
                  </Rectangle.Fill>
                </Rectangle>
              </Grid>
            </Border>
            <local:ContentControl
                                x:Name="contentPresenter"
                                Content="{TemplateBinding Content}"
                                FlowDirection="RightToLeft"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                />
            <Rectangle x:Name="DisabledVisualElement" RadiusX="3" RadiusY="3" Fill="#FFFFFFFF" Opacity="0" IsHitTestVisible="false" />
            <Rectangle x:Name="FocusVisualElement" RadiusX="2" RadiusY="2" Margin="1" Stroke="#FF6DBDD1" StrokeThickness="1" Opacity="0" IsHitTestVisible="false" />
          </Grid>-->
          <Grid>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="MouseOver">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#F2FFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#CCFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#7FFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Pressed">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
                    </ColorAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#D8FFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#C6FFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#8CFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#3FFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="FocusStates">
                <VisualState x:Name="Focused">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Unfocused"/>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Background" Background="White" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
              <Grid Margin="1" Background="{TemplateBinding Background}">
                <Border x:Name="BackgroundAnimation" Opacity="0" Background="#FF448DCA"/>
                <Rectangle x:Name="BackgroundGradient">
                  <Rectangle.Fill>
                    <LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
                      <GradientStop Color="#FFFFFFFF" Offset="0"/>
                      <GradientStop Color="#F9FFFFFF" Offset="0.375"/>
                      <GradientStop Color="#E5FFFFFF" Offset="0.625"/>
                      <GradientStop Color="#C6FFFFFF" Offset="1"/>
                    </LinearGradientBrush>
                  </Rectangle.Fill>
                </Rectangle>
              </Grid>
            </Border>
            <local:ContentControl
                                x:Name="contentPresenter"
                                Content="{TemplateBinding Content}"
                                FlowDirection="RightToLeft"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                />
            <Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" RadiusX="3" RadiusY="3" IsHitTestVisible="false" Opacity="0"/>
            <Rectangle x:Name="FocusVisualElement" Stroke="#FF6DBDD1" StrokeThickness="1" RadiusX="2" RadiusY="2" Margin="1" IsHitTestVisible="false" Opacity="0"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="local:CheckBox">
    <Setter Property="Background" Value="#FF448DCA"/>
    <Setter Property="Foreground" Value="#FF000000"/>
    <Setter Property="HorizontalContentAlignment" Value="Left"/>
    <Setter Property="VerticalContentAlignment" Value="Top"/>
    <Setter Property="Padding" Value="4,1,0,0"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="BorderBrush">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FFA3AEB9" Offset="0"/>
          <GradientStop Color="#FF8399A9" Offset="0.375"/>
          <GradientStop Color="#FF718597" Offset="0.375"/>
          <GradientStop Color="#FF617584" Offset="1"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:CheckBox">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="16"/>
            </Grid.ColumnDefinitions>
            <vsm:VisualStateManager.VisualStateGroups>
              <vsm:VisualStateGroup x:Name="CommonStates">
                <vsm:VisualState x:Name="Normal"/>
                <vsm:VisualState x:Name="MouseOver">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="BackgroundOverlay" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                    <DoubleAnimation Storyboard.TargetName="BoxMiddleBackground" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Duration="0" To="#7FFFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Duration="0" To="#CCFFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0" To="#F2FFFFFF"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Pressed">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="BackgroundOverlay" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                    <DoubleAnimation Storyboard.TargetName="BoxMiddleBackground" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Duration="0" To="#6BFFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Duration="0" To="#C6FFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0" To="#EAFFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0" To="#F4FFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Duration="0" To="#FF6DBDD1"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0" To="#FF6DBDD1"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0" To="#FF6DBDD1"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Duration="0" To="#FF6DBDD1"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To=".55"/>
                    <DoubleAnimation Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To="0.55"/>
                  </Storyboard>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
              <vsm:VisualStateGroup x:Name="CheckStates">
                <vsm:VisualState x:Name="Checked">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="CheckIcon" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To="1"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Unchecked"/>
                <vsm:VisualState x:Name="Indeterminate">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="IndeterminateIcon" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To="1"/>
                  </Storyboard>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
              <vsm:VisualStateGroup x:Name="FocusStates">
                <vsm:VisualState x:Name="Focused">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="ContentFocusVisualElement" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Unfocused" />
              </vsm:VisualStateGroup>
            </vsm:VisualStateManager.VisualStateGroups>
            <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1">
              <Rectangle x:Name="Background" Fill="#FFFFFFFF" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" RadiusX="1" RadiusY="1" Height="14" Margin="1" Width="14"/>
              <Rectangle x:Name="BackgroundOverlay" Fill="#FFC4DBEE" Stroke="#00000000" StrokeThickness="1" RadiusX="1" RadiusY="1" Height="14" Margin="1" Width="14" Opacity="0"/>
              <Rectangle x:Name="BoxMiddleBackground" Fill="{TemplateBinding Background}" Stroke="#00000000" StrokeThickness="1" RadiusX="1" RadiusY="1" Height="10" Width="10"/>
              <Rectangle x:Name="BoxMiddle" StrokeThickness="1" RadiusX="1" RadiusY="1" Height="10" Width="10">
                <Rectangle.Stroke>
                  <LinearGradientBrush EndPoint=".5,1" StartPoint=".5,0">
                    <GradientStop Color="#FFFFFFFF" Offset="1"/>
                    <GradientStop Color="#FFFFFFFF" Offset="0"/>
                    <GradientStop Color="#FFFFFFFF" Offset="0.375"/>
                    <GradientStop Color="#FFFFFFFF" Offset="0.375"/>
                  </LinearGradientBrush>
                </Rectangle.Stroke>
                <Rectangle.Fill>
                  <LinearGradientBrush EndPoint="0.64,0.88" StartPoint="0.62,0.15">
                    <GradientStop Color="#FFFFFFFF" Offset="0.013"/>
                    <GradientStop Color="#F9FFFFFF" Offset="0.375"/>
                    <GradientStop Color="#EAFFFFFF" Offset="0.603"/>
                    <GradientStop Color="#D8FFFFFF" Offset="1"/>
                  </LinearGradientBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle x:Name="BoxMiddleLine" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="1" RadiusY="1" Height="10" Width="10" Opacity=".2"/>
              <Path x:Name="CheckIcon" Fill="#FF333333" Stretch="Fill" Height="10" Margin="1,1,0,1.5" Width="10.5" Opacity="0" Data="M102.03442,598.79645 L105.22962,597.78918 L106.78825,600.42358 C106.78825,600.42358 108.51028,595.74304 110.21724,593.60419 C112.00967,591.35822 114.89314,591.42316 114.89314,591.42316 C114.89314,591.42316 112.67844,593.42645 111.93174,594.44464 C110.7449,596.06293 107.15683,604.13837 107.15683,604.13837 z"/>
              <Rectangle x:Name="IndeterminateIcon" Fill="#FF333333" Height="2" Width="6" Opacity="0"/>
              <Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" RadiusX="1" RadiusY="1" Height="14" Width="14" Opacity="0"/>
              <Rectangle x:Name="ContentFocusVisualElement" Stroke="#FF6DBDD1" StrokeThickness="1" RadiusX="2" RadiusY="2" Height="16" Width="16" IsHitTestVisible="false" Opacity="0"/>
              <Border x:Name="ValidationErrorElement" Margin="1" Visibility="Collapsed" BorderBrush="#FFDB000C" BorderThickness="1" CornerRadius="1" ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                <ToolTipService.ToolTip>
                  <ToolTip x:Name="validationTooltip" Template="{StaticResource ValidationToolTipTemplate}" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                    <ToolTip.Triggers>
                      <EventTrigger RoutedEvent="Canvas.Loaded">
                        <BeginStoryboard>
                          <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                              <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                  <System:Boolean>true</System:Boolean>
                                </DiscreteObjectKeyFrame.Value>
                              </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                          </Storyboard>
                        </BeginStoryboard>
                      </EventTrigger>
                    </ToolTip.Triggers>
                  </ToolTip>
                </ToolTipService.ToolTip>
                <Grid Height="10" HorizontalAlignment="Right" Margin="0,-4,-4,0" VerticalAlignment="Top" Width="10" Background="Transparent">
                  <Path Fill="#FFDC000C" Margin="0,3,0,0" Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z"/>
                  <Path Fill="#ffffff" Margin="0,3,0,0" Data="M 0,0 L2,0 L 7,5 L7,7"/>
                </Grid>
              </Border>
            </Grid>
            <local:ContentControl
                                Grid.Column="0"
                                x:Name="contentPresenter"
                                Content="{TemplateBinding Content}"
                                FlowDirection="RightToLeft"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Margin="{TemplateBinding Padding}"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="local:HyperlinkButton">
    <Setter Property="IsEnabled" Value="true" />
    <Setter Property="IsTabStop" Value="true" />
    <Setter Property="Foreground" Value="#FF73A9D8" />
    <Setter Property="Padding" Value="2,0,2,0"/>
    <Setter Property="Cursor" Value="Hand" />
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="VerticalAlignment" Value="Top" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:HyperlinkButton">
          <!--<Grid Cursor="{TemplateBinding Cursor}">
            <Grid.Resources>
              <Color x:Key="FocusColor">#FF333333</Color>
              <SolidColorBrush x:Name="HoverColor" Color="#FF99C3F7"/>
            </Grid.Resources>
            <vsm:VisualStateManager.VisualStateGroups>
              <vsm:VisualStateGroup x:Name="CommonStates">
                <vsm:VisualState x:Name="Normal" />
              </vsm:VisualStateGroup>
              <vsm:VisualStateGroup x:Name="FocusStates">
                <vsm:VisualState x:Name="Focused">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Visibility" Duration="0">
                      <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                          <Visibility>Visible</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                      </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Unfocused">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Visibility" Duration="0">
                      <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                          <Visibility>Collapsed</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                      </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
            </vsm:VisualStateManager.VisualStateGroups>

            <Rectangle x:Name="FocusVisual" StrokeDashCap="Round" StrokeDashArray=".2 5" Visibility="Collapsed" IsHitTestVisible="false">
              <Rectangle.Stroke>
                <SolidColorBrush Color="{StaticResource FocusColor}" />
              </Rectangle.Stroke>
            </Rectangle>
            <local:ContentControl 
              x:Name="Content"
              Content="{TemplateBinding Content}" 
              ContentTemplate="{TemplateBinding ContentTemplate}"
              FlowDirection="RightToLeft"
              HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
              VerticalAlignment="{TemplateBinding VerticalAlignment}"
              Margin="0,-2,0,0"
              />
          </Grid>-->
          <Grid Cursor="{TemplateBinding Cursor}" Background="{TemplateBinding Background}">
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="MouseOver">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="UnderlineTextBlock" Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                          <Visibility>Visible</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                      </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Pressed">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="UnderlineTextBlock" Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                          <Visibility>Visible</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                      </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="DisabledOverlay" Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                          <Visibility>Visible</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                      </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="FocusStates">
                <VisualState x:Name="Focused">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Unfocused"/>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <local:TextBlock x:Name="UnderlineTextBlock" TextWrapping="NoWrap"
                             FlowDirection="RightToLeft"
                             HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                             Margin="{TemplateBinding Padding}" 
                             VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                             Visibility="Collapsed" Text="{TemplateBinding Content}" 
                             TextDecorations="Underline"/>
            <local:TextBlock x:Name="DisabledOverlay"  TextWrapping="NoWrap"
                             FlowDirection="RightToLeft"
                             HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                             Margin="{TemplateBinding Padding}" 
                             VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                             Visibility="Collapsed" Foreground="#FFAAAAAA" 
                             Text="{TemplateBinding Content}" Canvas.ZIndex="1"/>
            <local:TextBlock 
              x:Name="Content" TextWrapping="NoWrap"
              Text="{TemplateBinding Content}" 
              FlowDirection="RightToLeft"
              HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
              VerticalAlignment="{TemplateBinding VerticalAlignment}"
              Margin="{TemplateBinding Padding}"
              />

            <Rectangle x:Name="FocusVisualElement" Stroke="#FF6DBDD1" StrokeThickness="1" IsHitTestVisible="false" Opacity="0"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="local:RadioButton">
    <Setter Property="Background" Value="#FF448DCA"/>
    <Setter Property="Foreground" Value="#FF000000"/>
    <Setter Property="HorizontalContentAlignment" Value="Left"/>
    <Setter Property="VerticalContentAlignment" Value="Top"/>
    <Setter Property="Padding" Value="4,1,0,0"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="BorderBrush">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FFA3AEB9" Offset="0"/>
          <GradientStop Color="#FF8399A9" Offset="0.375"/>
          <GradientStop Color="#FF718597" Offset="0.375"/>
          <GradientStop Color="#FF617584" Offset="1"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:RadioButton">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="16"/>
            </Grid.ColumnDefinitions>
            <vsm:VisualStateManager.VisualStateGroups>
              <vsm:VisualStateGroup x:Name="CommonStates">
                <vsm:VisualState x:Name="Normal"/>
                <vsm:VisualState x:Name="MouseOver">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="BackgroundOverlay" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                    <DoubleAnimation Storyboard.TargetName="BoxMiddleBackground" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Duration="0" To="#7FFFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Duration="0" To="#CCFFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0" To="#F2FFFFFF"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Pressed">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="BackgroundOverlay" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                    <DoubleAnimation Storyboard.TargetName="BoxMiddleBackground" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Duration="0" To="#6BFFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Duration="0" To="#C6FFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0" To="#EAFFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0" To="#F4FFFFFF"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Duration="0" To="#FF6DBDD1"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0" To="#FF6DBDD1"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0" To="#FF6DBDD1"/>
                    <ColorAnimation Storyboard.TargetName="BoxMiddle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Duration="0" To="#FF6DBDD1"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To=".55"/>
                    <DoubleAnimation Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To="0.55"/>
                  </Storyboard>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
              <vsm:VisualStateGroup x:Name="CheckStates">
                <vsm:VisualState x:Name="Checked">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="CheckIcon" Storyboard.TargetProperty="(UIElement.Opacity)" Duration="0" To="1"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Unchecked"/>
              </vsm:VisualStateGroup>
              <vsm:VisualStateGroup x:Name="FocusStates">
                <vsm:VisualState x:Name="Focused">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="ContentFocusVisualElement" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Unfocused" />
              </vsm:VisualStateGroup>
            </vsm:VisualStateManager.VisualStateGroups>
            <Grid HorizontalAlignment="Left" Grid.Column="1" VerticalAlignment="Center">
              <Ellipse x:Name="Background" Width="14" Height="14" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" Fill="#FFFFFFFF" Margin="1"/>
              <Ellipse x:Name="BackgroundOverlay" Fill="#FFC4DBEE" Opacity="0" Width="14" Height="14" StrokeThickness="1" Margin="1" Stroke="#00000000"/>
              <Ellipse x:Name="BoxMiddleBackground" Width="10" Height="10" Fill="{TemplateBinding Background}" Stroke="#00000000" StrokeThickness="1"/>
              <Ellipse x:Name="BoxMiddle" Width="10" Height="10" StrokeThickness="1" >
                <Ellipse.Stroke>
                  <LinearGradientBrush EndPoint=".5,1" StartPoint=".5,0">
                    <GradientStop Color="#FFFFFFFF" Offset="1"/>
                    <GradientStop Color="#FFFFFFFF" Offset="0"/>
                    <GradientStop Color="#FFFFFFFF" Offset="0.375"/>
                    <GradientStop Color="#FFFFFFFF" Offset="0.375"/>
                  </LinearGradientBrush>
                </Ellipse.Stroke>
                <Ellipse.Fill>
                  <LinearGradientBrush StartPoint="0.62,0.15" EndPoint="0.64,0.88">
                    <GradientStop Color="#FFFFFFFF" Offset="0.013" />
                    <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                    <GradientStop Color="#EAFFFFFF" Offset="0.603" />
                    <GradientStop Color="#D8FFFFFF" Offset="1" />
                  </LinearGradientBrush>
                </Ellipse.Fill>
              </Ellipse>
              <Ellipse x:Name="BoxMiddleLine" Width="10" Height="10" Stroke="#FF333333" StrokeThickness="1" Opacity=".2"/>
              <Ellipse x:Name="CheckIcon" Fill="#FF333333" Width="4" Height="4" Opacity="0"/>
              <Ellipse x:Name="DisabledVisualElement" Width="14" Height="14" Opacity="0" Fill="#FFFFFFFF"/>
              <Ellipse x:Name="ContentFocusVisualElement" Stroke="#FF6DBDD1" StrokeThickness="1" Opacity="0" IsHitTestVisible="false" Width="16" Height="16" />
            </Grid>
            <local:ContentControl
                                Grid.Column="0"
                                x:Name="contentPresenter"
                                Content="{TemplateBinding Content}"
                                FlowDirection="RightToLeft"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                HorizontalAlignment="Right"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Margin="{TemplateBinding Padding}"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="local:ToggleButton">
    <Setter Property="Background" Value="#FF1F3B53"/>
    <Setter Property="Foreground" Value="#FF000000"/>
    <Setter Property="Padding" Value="3"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="BorderBrush">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FFA3AEB9" Offset="0"/>
          <GradientStop Color="#FF8399A9" Offset="0.375"/>
          <GradientStop Color="#FF718597" Offset="0.375"/>
          <GradientStop Color="#FF617584" Offset="1"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:ToggleButton">
          <Grid>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="MouseOver">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#F2FFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#CCFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#7FFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Pressed">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#FF6DBDD1"/>
                    </ColorAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#D8FFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#C6FFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#8CFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#3FFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="CheckStates">
                <VisualState x:Name="Checked">
                  <Storyboard>
                    <PointAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(LinearGradientBrush.StartPoint)">
                      <SplinePointKeyFrame KeyTime="0" Value="0.7,1"/>
                    </PointAnimationUsingKeyFrames>
                    <PointAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="(Rectangle.Fill).(LinearGradientBrush.EndPoint)">
                      <SplinePointKeyFrame KeyTime="0" Value="0.7,0"/>
                    </PointAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Unchecked"/>
              </VisualStateGroup>
              <VisualStateGroup x:Name="FocusStates">
                <VisualState x:Name="Focused">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Unfocused"/>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Background" Background="White" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
              <Grid Margin="1" Background="{TemplateBinding Background}">
                <Border x:Name="BackgroundAnimation" Opacity="0" Background="#FF448DCA"/>
                <Rectangle x:Name="BackgroundGradient">
                  <Rectangle.Fill>
                    <LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
                      <GradientStop Color="#FFFFFFFF" Offset="0"/>
                      <GradientStop Color="#F9FFFFFF" Offset="0.375"/>
                      <GradientStop Color="#E5FFFFFF" Offset="0.625"/>
                      <GradientStop Color="#C6FFFFFF" Offset="1"/>
                    </LinearGradientBrush>
                  </Rectangle.Fill>
                </Rectangle>
              </Grid>
            </Border>
            <local:ContentControl x:Name="contentPresenter" 
              Content="{TemplateBinding Content}" 
              FlowDirection="RightToLeft" 
              Margin="{TemplateBinding Padding}" 
              ContentTemplate="{TemplateBinding ContentTemplate}"
              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
            <Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" RadiusX="3" RadiusY="3" IsHitTestVisible="false" Opacity="0"/>
            <Rectangle x:Name="FocusVisualElement" Stroke="#FF6DBDD1" StrokeThickness="1" RadiusX="2" RadiusY="2" Margin="1" IsHitTestVisible="false" Opacity="0"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>



  <!-- DataGrid-->
  <Style TargetType="local:DataGrid">
    <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
    <Setter Property="RowBackground">
      <Setter.Value>
        <SolidColorBrush Color="#FFF2F2F2"/>
      </Setter.Value>
    </Setter>
    <Setter Property="AlternatingRowBackground">
      <Setter.Value>
        <SolidColorBrush Color="#FFFFFFFF"/>
      </Setter.Value>
    </Setter>
    <Setter Property="AutoGenerateColumns" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:DataGrid">
          <Border BorderBrush="#FF000000" BorderThickness="1">
            <Border BorderBrush="#FFFFFFFF" BorderThickness="1">
              <Border BorderBrush="#FFA4A4A4" BorderThickness="1">
                <Grid x:Name="Director" >
                  <Grid x:Name="RootElement" RenderTransformOrigin="0.5,0.5">
                    <Grid.Resources>
                      <!-- Focus related animations -->
                      <Storyboard x:Name="Normal State">
                        <DoubleAnimation Duration="0:0:0" 
                                      Storyboard.TargetName="FocusVisualElement"
                                      Storyboard.TargetProperty="Opacity"
                                      To="1" />
                      </Storyboard>
                      <Storyboard x:Name="Unfocused State">
                        <DoubleAnimation Duration="0:0:0" 
                                      Storyboard.TargetName="FocusVisualElement" 
                                      Storyboard.TargetProperty="Opacity"
                                      To="0" />
                      </Storyboard>
                      <ControlTemplate x:Key="TopLeftHeaderTemplate" TargetType="local:DataGridColumnHeader">
                        <Grid x:Name="RootElement">
                          <Grid.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0.28,0.71">
                              <GradientStop Color="#FFF9FAFA" Offset="0"/>
                              <GradientStop x:Name="StopColor2" Color="#FFEDF1F4" Offset="0.37259"/>
                              <GradientStop x:Name="StopColor3" Color="#FFE2E8EF" Offset="0.372881"/>
                              <GradientStop x:Name="StopColor4" Color="#FFC3C9CD" Offset="1"/>
                            </LinearGradientBrush>
                          </Grid.Background>

                          <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                          </Grid.RowDefinitions>

                          <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                          </Grid.ColumnDefinitions>

                          <Line Stretch="Fill" Grid.Column="1" Grid.RowSpan="2" X1="0" X2="0" Y1="0" Y2="1" StrokeThickness="1" Stroke="#FFA4A4A4" />
                          <Line Stretch="Fill" Grid.ColumnSpan="2" Grid.Row="2" X1="0" X2="1" Y1="0" Y2="0" StrokeThickness="1" Stroke="#FFA4A4A4" />
                          <!--<Line Stretch="Fill" Grid.RowSpan="2" X1="0" X2="0" Y1="0" Y2="1" StrokeThickness="1" Stroke="{TemplateBinding SeparatorBrush}" Visibility="{TemplateBinding SeparatorVisibility}"/>-->
                          <Rectangle Stretch="Fill" Width="39"  StrokeThickness="2" Stroke="#FFFFFFFF" Grid.RowSpan="2"/>
                          <Path Margin="1,1,1,0" Stretch="Fill" Data="F1 M 547.239,124.863L 430.795,124.863L 430.795,135.106C 447.845,138.848 467.753,140.997 489.017,140.997C 510.281,140.997 530.188,138.848 547.239,135.106L 547.239,124.863 Z ">
                            <Path.Fill>
                              <LinearGradientBrush StartPoint="0.5125,-0.0864589" EndPoint="0.5125,1.00202">
                                <GradientStop Color="#B3FFFFFF" Offset="0"/>
                                <GradientStop Color="#3CFFFFFF" Offset="1"/>
                              </LinearGradientBrush>
                            </Path.Fill>
                          </Path>
                        </Grid>
                      </ControlTemplate>

                      <ControlTemplate x:Key="TopRightHeaderTemplate" TargetType="local:DataGridColumnHeader">
                        <Grid x:Name="RootElement">
                          <Grid.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0.28,0.71">
                              <GradientStop Color="#FFF9FAFA" Offset="0"/>
                              <GradientStop x:Name="StopColor2" Color="#FFEDF1F4" Offset="0.37259"/>
                              <GradientStop x:Name="StopColor3" Color="#FFE2E8EF" Offset="0.372881"/>
                              <GradientStop x:Name="StopColor4" Color="#FFC3C9CD" Offset="1"/>
                            </LinearGradientBrush>
                          </Grid.Background>

                          <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                          </Grid.RowDefinitions>

                          <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                          </Grid.ColumnDefinitions>

                          <!--<Line Stretch="Fill" Grid.RowSpan="2" X1="0" X2="0" Y1="0" Y2="1" StrokeThickness="1" Stroke="{TemplateBinding SeparatorBrush}" Visibility="{TemplateBinding SeparatorVisibility}"/>-->
                          <Line Stretch="Fill" Grid.RowSpan="2" X1="0" X2="0" Y1="0" Y2="1" StrokeThickness="1" Stroke="#FFA4A4A4" />
                          <Line Stretch="Fill" Grid.ColumnSpan="2" Grid.Row="2" X1="0" X2="1" Y1="0" Y2="0" StrokeThickness="1" Stroke="#FFA4A4A4" />
                          <Rectangle Stretch="Fill" StrokeThickness="2" Stroke="#FFFFFFFF" Grid.Column="1" Grid.RowSpan="2"/>
                          <Path Grid.Column="1" Margin="1,1,1,0" Stretch="Fill" Data="F1 M 547.239,124.863L 430.795,124.863L 430.795,135.106C 447.845,138.848 467.753,140.997 489.017,140.997C 510.281,140.997 530.188,138.848 547.239,135.106L 547.239,124.863 Z ">
                            <Path.Fill>
                              <LinearGradientBrush StartPoint="0.5125,-0.0864589" EndPoint="0.5125,1.00202">
                                <GradientStop Color="#B3FFFFFF" Offset="0"/>
                                <GradientStop Color="#3CFFFFFF" Offset="1"/>
                              </LinearGradientBrush>
                            </Path.Fill>
                          </Path>
                        </Grid>
                      </ControlTemplate>
                    </Grid.Resources>
                    <Grid.Background>
                      <SolidColorBrush Color="Transparent" />
                    </Grid.Background>
                    <Grid.RenderTransform >
                      <ScaleTransform x:Name="dir">
                      </ScaleTransform>
                    </Grid.RenderTransform>
                    <Grid.RowDefinitions>
                      <RowDefinition Height="Auto" />
                      <RowDefinition Height="*" />
                      <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="Auto" />
                      <ColumnDefinition Width="*" />
                      <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <!-- Row 0 -->
                    <local:DataGridColumnHeader  x:Name="TopLeftCornerHeaderElement" Template="{StaticResource TopLeftHeaderTemplate}" />
                    <Canvas x:Name="ColumnHeadersPresenterElement" Grid.Column="1"/>
                    <local:DataGridColumnHeader x:Name="TopRightCornerHeaderElement" Grid.Column="2" Template="{StaticResource TopRightHeaderTemplate}" />

                    <!-- Row 1 -->
                    <Canvas x:Name="RowHeadersPresenterElement" Grid.Row="1"/>

                    <Canvas x:Name="CellsPresenterElement" Grid.Column="1" Grid.Row="1">
                      <Canvas.Resources>
                        <!---->
                                <SolidColorBrush x:Key="DefaultVerticalGridlinesBrush" Color="#FFACACAC"/>
                                <SolidColorBrush x:Key="DefaultHorizontalGridlinesBrush" Color="#FFACACAC"/> 
                            </Canvas.Resources> 
                        </Canvas>
 
                        <Rectangle x:Name="FocusVisualElement" Stroke="#FF400000" StrokeDashArray=".2 4"
                            HorizontalAlignment="Left" VerticalAlignment="Top" StrokeDashCap="Round"
                            IsHitTestVisible="false" Opacity="0" Grid.Column="1" Grid.Row="1"/> 

                        <primitives:ScrollBar x:Name="VerticalScrollbarElement" Orientation="Vertical" Grid.Column="2" Grid.Row="1" Width="18" />
 
                        <!-- Row 2 -->
                        <Rectangle Fill="#FFE7E7E7" Grid.Row="2"/>
                        <primitives:ScrollBar x:Name="HorizontalScrollbarElement" Orientation="Horizontal" Grid.Column="1" Grid.Row="2" Height="18" />
                        <Rectangle Fill="#FFE7E7E7" Grid.Column="2" Grid.Row="2" />
                  </Grid>
                </Grid>

              </Border>
            </Border>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="local:DataGridRow">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:DataGridRow">
          <Grid Name="RootElement" >
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <Grid.Resources>
              <Storyboard x:Name="Normal State">
                <ColorAnimation Storyboard.TargetName="fillStop0" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>
                <ColorAnimation Storyboard.TargetName="fillStop1" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>
                <ColorAnimation Storyboard.TargetName="fillStop2" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>

                <ColorAnimation Storyboard.TargetName="strokeStop0" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>
                <ColorAnimation Storyboard.TargetName="strokeStop1" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>
              </Storyboard>
              <Storyboard x:Name="Normal AlternatingRow State">
                <ColorAnimation Storyboard.TargetName="fillStop0" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>
                <ColorAnimation Storyboard.TargetName="fillStop1" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>
                <ColorAnimation Storyboard.TargetName="fillStop2" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>

                <ColorAnimation Storyboard.TargetName="strokeStop0" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>
                <ColorAnimation Storyboard.TargetName="strokeStop1" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>
              </Storyboard>
              <Storyboard x:Name="MouseOver State">
                <ColorAnimation Storyboard.TargetName="fillStop0" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FFF9FAFA"/>
                <ColorAnimation Storyboard.TargetName="fillStop1" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FFE6EFF7"/>
                <ColorAnimation Storyboard.TargetName="fillStop2" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FFD3E4F5"/>

                <ColorAnimation Storyboard.TargetName="strokeStop0" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>
                <ColorAnimation Storyboard.TargetName="strokeStop1" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#00000000"/>
              </Storyboard>
              <Storyboard x:Name="Normal Selected State">
                <ColorAnimation Storyboard.TargetName="fillStop0" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FFD9EFFF"/>
                <ColorAnimation Storyboard.TargetName="fillStop1" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FFBDD2E6"/>
                <ColorAnimation Storyboard.TargetName="fillStop2" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FFA1B6CD"/>

                <ColorAnimation Storyboard.TargetName="strokeStop0" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FF77B9EB"/>
                <ColorAnimation Storyboard.TargetName="strokeStop1" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FF4887CD"/>
              </Storyboard>
              <Storyboard x:Name="MouseOver Selected State">
                <ColorAnimation Storyboard.TargetName="fillStop0" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FFF9FAFA"/>
                <ColorAnimation Storyboard.TargetName="fillStop1" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FFE6EFF7"/>
                <ColorAnimation Storyboard.TargetName="fillStop2" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FFD3E4F5"/>

                <ColorAnimation Storyboard.TargetName="strokeStop0" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FF77B9EB"/>
                <ColorAnimation Storyboard.TargetName="strokeStop1" Storyboard.TargetProperty="Color" Duration="00:00:0.001" To="#FF4887CD"/>
              </Storyboard>
              <Storyboard x:Name="Normal DetailsVisible State">
                <DoubleAnimation Storyboard.TargetName="DetailsPresenterElement" Storyboard.TargetProperty="Height" Duration="00:00:0.1" />
              </Storyboard>
            </Grid.Resources>

            <!-- TODO: Enable when Control supports background 
                        
                            
                        -->

            <Rectangle Grid.RowSpan="2" Name="overlayRectangle" StrokeThickness="1">
              <Rectangle.Fill>
                <LinearGradientBrush StartPoint="0.316111,0.0165521" EndPoint="0.316111,0.724833">
                  <GradientStop x:Name="fillStop0" Color="#00000000" Offset="0"/>
                  <GradientStop x:Name="fillStop1" Color="#00000000" Offset="0.682203"/>
                  <GradientStop x:Name="fillStop2" Color="#00000000" Offset="1"/>
                </LinearGradientBrush>
              </Rectangle.Fill>
              <Rectangle.Stroke>
                <LinearGradientBrush StartPoint="0.318122,0.0360108" EndPoint="0.318122,0.715784">
                  <GradientStop x:Name="strokeStop0" Color="#00000000" Offset="0"/>
                  <GradientStop x:Name="strokeStop1" Color="#00000000" Offset="1"/>
                </LinearGradientBrush>
              </Rectangle.Stroke>
            </Rectangle>

            <Canvas Name="CellsPresenterElement"  RenderTransformOrigin="0.5,0.5">
              <!--<Canvas.RenderTransform>
                                <ScaleTransform ScaleX="-1" />
                            </Canvas.RenderTransform>-->

            </Canvas>
            <Canvas Grid.Row="1" Name="DetailsPresenterElement" />

          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="local:DataGridRowHeader">
    <Setter Property="SeparatorBrush">
      <Setter.Value>
        <SolidColorBrush Color="#FFA4A4A4"/>
      </Setter.Value>
    </Setter>
    <Setter Property="SeparatorVisibility" Value="Visible"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:DataGridRowHeader">
          <Grid x:Name="RootElement">
            <Grid.Resources>
              <Storyboard x:Name="Normal State">
                <DoubleAnimation Storyboard.TargetName="MouseOverRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
                <DoubleAnimation Storyboard.TargetName="SelectedRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
                <DoubleAnimation Storyboard.TargetName="CurrentRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
                <DoubleAnimation Storyboard.TargetName="EditingRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
              </Storyboard>
              <Storyboard x:Name="MouseOver State">
                <DoubleAnimation Storyboard.TargetName="MouseOverRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="1"/>
                <DoubleAnimation Storyboard.TargetName="SelectedRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
                <DoubleAnimation Storyboard.TargetName="CurrentRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
                <DoubleAnimation Storyboard.TargetName="EditingRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
              </Storyboard>
              <Storyboard x:Name="MouseOver CurrentRow Selected State">
                <DoubleAnimation Storyboard.TargetName="MouseOverRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="1"/>
                <DoubleAnimation Storyboard.TargetName="SelectedRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="1"/>
                <DoubleAnimation Storyboard.TargetName="CurrentRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="1"/>
                <DoubleAnimation Storyboard.TargetName="EditingRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
              </Storyboard>
              <Storyboard x:Name="Normal CurrentRow State">
                <DoubleAnimation Storyboard.TargetName="MouseOverRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
                <DoubleAnimation Storyboard.TargetName="SelectedRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="1"/>
                <DoubleAnimation Storyboard.TargetName="CurrentRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="1"/>
                <DoubleAnimation Storyboard.TargetName="EditingRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
              </Storyboard>
              <Storyboard x:Name="Normal Selected State">
                <DoubleAnimation Storyboard.TargetName="MouseOverRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
                <DoubleAnimation Storyboard.TargetName="SelectedRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="1"/>
                <DoubleAnimation Storyboard.TargetName="CurrentRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
                <DoubleAnimation Storyboard.TargetName="EditingRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
              </Storyboard>
              <Storyboard x:Name="Normal EditingRow State">
                <DoubleAnimation Storyboard.TargetName="MouseOverRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
                <DoubleAnimation Storyboard.TargetName="SelectedRectangle" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="1"/>
                <DoubleAnimation Storyboard.TargetName="CurrentRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0"/>
                <DoubleAnimation Storyboard.TargetName="EditingRowGlyph" Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="1"/>
              </Storyboard>
            </Grid.Resources>

            <Grid.Background>
              <LinearGradientBrush StartPoint="0.150784,-0.00331224" EndPoint="0.150784,0.709776">
                <GradientStop Color="#FFF9FAFA" Offset="0"/>
                <GradientStop Color="#FFEDF1F4" Offset="0.37259"/>
                <GradientStop Color="#FFE2E8EF" Offset="0.372881"/>
                <GradientStop Color="#FFC3C9CD" Offset="1"/>
              </LinearGradientBrush>
            </Grid.Background>

            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="*" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="*" />
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <Line Stretch="Fill" Grid.Column="2" Grid.RowSpan="2" X1="0" X2="0" Y1="0" Y2="1" StrokeThickness="1" Stroke="#FFA4A4A4" />
            <Line Stretch="Fill" Grid.Row="2" Grid.ColumnSpan="3" X1="0" X2="1" Y1="0" Y2="0" StrokeThickness="1" Stroke="{TemplateBinding SeparatorBrush}" Visibility="{TemplateBinding SeparatorVisibility}" />

            <Rectangle Stretch="Fill" StrokeThickness="2" Stroke="#FFFFFFFF" Grid.RowSpan="2" Grid.ColumnSpan="2"/>

            <Rectangle x:Name="MouseOverRectangle" Stretch="Fill" Grid.RowSpan="2" Grid.ColumnSpan="2" StrokeThickness="1" Opacity="0" >
              <Rectangle.Fill>
                <LinearGradientBrush StartPoint="0.150784,-0.00340433" EndPoint="0.150784,0.709813">
                  <GradientStop Color="#FFF9FAFA" Offset="0"/>
                  <GradientStop Color="#FFE6EFF7" Offset="0.323947"/>
                  <GradientStop Color="#FFD3E4F5" Offset="0.324201"/>
                  <GradientStop Color="#FF87A5BA" Offset="1"/>
                </LinearGradientBrush>
              </Rectangle.Fill>
            </Rectangle>

            <Rectangle x:Name="SelectedRectangle" Stretch="Fill" Grid.RowSpan="2" Grid.ColumnSpan="3" StrokeThickness="1" Opacity="0">
              <Rectangle.Fill>
                <LinearGradientBrush StartPoint="0.316111,0.0165521" EndPoint="0.316111,0.724833">
                  <GradientStop Color="#FFD9EFFF" Offset="0"/>
                  <GradientStop Color="#FFA5CDF6" Offset="0.682203"/>
                  <GradientStop Color="#FF72ACED" Offset="0.987288"/>
                </LinearGradientBrush>
              </Rectangle.Fill>
              <Rectangle.Stroke>
                <LinearGradientBrush StartPoint="0.154316,0.0102538" EndPoint="0.154316,0.704122">
                  <GradientStop Color="#FF77B9EB" Offset="0"/>
                  <GradientStop Color="#FF4887CD" Offset="0.987288"/>
                </LinearGradientBrush>
              </Rectangle.Stroke>
            </Rectangle>

            <local:ContentControl  VerticalAlignment="Top" Margin="0,2,2,0" Grid.Column="1"  Grid.RowSpan="2" />

            <Path x:Name="CurrentRowGlyph" VerticalAlignment="Top" Width="6" Height="10"  Margin="8,6,8,1" Grid.Column="0" Grid.RowSpan="2" Stretch="Fill" Opacity="0" Data="F1 M 511.047,352.682L 511.047,342.252L 517.145,347.467L 511.047,352.682 Z ">
              <Path.Fill>
                <LinearGradientBrush StartPoint="-0.0590768,-0.150498" EndPoint="-0.0590768,1.74511">
                  <LinearGradientBrush.GradientStops>
                    <GradientStop Color="#FF69ACDF" Offset="0"/>
                    <GradientStop Color="#FF346D9B" Offset="0.529661"/>
                    <GradientStop Color="#FF002E58" Offset="1"/>
                  </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
              </Path.Fill>
            </Path>

            <Path x:Name="EditingRowGlyph" VerticalAlignment="Top" Width="12" Height="12"  Margin="5,5,5,0" Grid.Column="0" Grid.RowSpan="2" Stretch="Fill" Opacity="0" Data="F1 M 352.313,248.335C 352.313,243.73 348.58,239.998 343.975,239.998C 339.371,239.998 335.638,243.73 335.638,248.335C 335.638,252.94 339.371,256.673 343.975,256.673C 348.58,256.673 352.313,252.94 352.313,248.335 Z M 349.518,248.335L 341.433,252.683L 341.433,243.987L 349.518,248.335 Z ">
              <Path.Fill>
                <LinearGradientBrush StartPoint="0.456819,-0.0497213" EndPoint="0.456819,1.14968">
                  <LinearGradientBrush.GradientStops>
                    <GradientStop Color="#FF77B9EB" Offset="0"/>
                    <GradientStop Color="#FF3B85C3" Offset="0.520842"/>
                    <GradientStop Color="#FF00529C" Offset="0.521186"/>
                    <GradientStop Color="#FF246CB4" Offset="0.758187"/>
                    <GradientStop Color="#FF4887CD" Offset="0.987288"/>
                  </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
              </Path.Fill>
            </Path>

          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style TargetType="local:DataGridColumnHeader">
    <Setter Property="SeparatorBrush">
      <Setter.Value>
        <SolidColorBrush Color="#FFA4A4A4"/>
      </Setter.Value>
    </Setter>
    <Setter Property="SeparatorVisibility" Value="Visible"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:DataGridColumnHeader">
          <Grid x:Name="RootElement" RenderTransformOrigin="0.5,0.5">
            <Grid.RenderTransform >
              <ScaleTransform x:Name="dir">
              </ScaleTransform>
            </Grid.RenderTransform>
            <Grid.Background>
              <LinearGradientBrush StartPoint="0.276463,-0.00385181" EndPoint="0.276463,0.71">
                <GradientStop Color="#FFF9FAFA" Offset="0"/>
                <GradientStop x:Name="StopColor2" Color="#FFEDF1F4" Offset="0.37259"/>
                <GradientStop x:Name="StopColor3" Color="#FFE2E8EF" Offset="0.372881"/>
                <GradientStop x:Name="StopColor4" Color="#FFC3C9CD" Offset="1"/>
              </LinearGradientBrush>
            </Grid.Background>

            <Grid.Resources>
              <!---->
                            <Storyboard x:Name="Normal State">
                                <ColorAnimation Storyboard.TargetName="StopColor2" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FFEDF1F4"/> 
                                <ColorAnimation Storyboard.TargetName="StopColor3" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FFE2E8EF"/> 
                                <ColorAnimation Storyboard.TargetName="StopColor4" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FFC3C9CD"/>
                            </Storyboard> 
                            <Storyboard x:Name="MouseOver State">
                                <ColorAnimation Storyboard.TargetName="StopColor2" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FFE6EFF7"/>
                                <ColorAnimation Storyboard.TargetName="StopColor3" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FFD3E4F5"/> 
                                <ColorAnimation Storyboard.TargetName="StopColor4" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FF87A5BA"/>
                            </Storyboard>
                        </Grid.Resources> 
 
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" /> 
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions> 
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" /> 
                        </Grid.ColumnDefinitions> 

                        <Rectangle Stretch="Fill" StrokeThickness="2" Stroke="#FFFFFFFF" Grid.RowSpan="2"/> 
                        <Line Stretch="Fill" Grid.Row="2" Grid.ColumnSpan="2" X1="0" X2="1" Y1="0" Y2="0" StrokeThickness="1" Stroke="#FFA4A4A4" />
                        <Line Stretch="Fill" Grid.RowSpan="2" Grid.Column="1" X1="0" X2="0" Y1="0" Y2="1" StrokeThickness="1" Stroke="{TemplateBinding SeparatorBrush}" Visibility="{TemplateBinding SeparatorVisibility}" />
                        <Path Margin="1,1,1,0" Stretch="Fill" Data="F1 M 547.239,124.863L 430.795,124.863L 430.795,135.106C 447.845,138.848 467.753,140.997 489.017,140.997C 510.281,140.997 530.188,138.848 547.239,135.106L 547.239,124.863 Z "> 
                            <Path.Fill>
                                <LinearGradientBrush StartPoint="0.5125,-0.0864589" EndPoint="0.5125,1.00202">
                                    <GradientStop Color="#B3FFFFFF" Offset="0"/> 
                                    <GradientStop Color="#3CFFFFFF" Offset="1"/> 
                                </LinearGradientBrush>
                            </Path.Fill> 
                        </Path>

                        <local:ContentControl Content="{TemplateBinding Content}" Margin="3,0,3,0" Grid.RowSpan="2" VerticalAlignment="Center"/> 
                    </Grid>
                </ControlTemplate>
            </Setter.Value> 
        </Setter> 
    </Style>
    
    <Style TargetType="local:DataGridCell">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Cursor" Value="Arrow" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DataGridCell">
                    <Grid Name="Root" Background="Transparent" RenderTransformOrigin="0.5,0.5" >
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CurrentStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Regular" />
                                <vsm:VisualState x:Name="Current">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>


                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                                      <Grid.RenderTransform >
                                            <ScaleTransform x:Name="dir">
                                            </ScaleTransform>
                                        </Grid.RenderTransform>
                        <Rectangle Name="FocusVisual" Stroke="#FF77E4FF" StrokeThickness="1" Fill="#66FFFFFF" HorizontalAlignment="Stretch" 
                               VerticalAlignment="Stretch" IsHitTestVisible="false" Opacity="0" />

                        <ContentPresenter  RenderTransformOrigin="0.5,0.5"
                              Content="{TemplateBinding Content}"
                              ContentTemplate="{TemplateBinding ContentTemplate}"
                              Cursor="{TemplateBinding Cursor}"
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                              Margin="{TemplateBinding Padding}" >
                           </ContentPresenter> 


                        <Rectangle Name="RightGridLine" Grid.Column="1" VerticalAlignment="Stretch" Width="1" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="local:ListBox">
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Background" Value="#FFFFFFFF" />
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="TabNavigation" Value="Once" />
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>  
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ListBox">
                    <!--<Border CornerRadius="2" 
			                BorderBrush="{TemplateBinding BorderBrush}"
			                BorderThickness="{TemplateBinding BorderThickness}">
                        <ScrollViewer x:Name="ScrollViewer" Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" BorderBrush="Transparent" BorderThickness="0">
                            <ScrollViewer.Template>
                                <ControlTemplate TargetType="ScrollViewer">
                                    <Border CornerRadius="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                                        <Grid Background="{TemplateBinding Background}">
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="*"/>
                                                <RowDefinition Height="Auto"/>
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>

                                            <ScrollContentPresenter x:Name="ScrollContentPresenter"
                                                                    Cursor="{TemplateBinding Cursor}"
                                                                    Margin="{TemplateBinding Padding}"
                                                                    Grid.Column="1"
                                                                    ContentTemplate="{TemplateBinding ContentTemplate}"/>

                                            <Rectangle Grid.Column="0" Grid.Row="1" Fill="#FFE9EEF4"/>

                                            <ScrollBar x:Name="VerticalScrollBar" Width="18"
                                                       IsTabStop="False"
                                                       Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                                       Grid.Column="0" Grid.Row="0" Orientation="Vertical"
                                                       ViewportSize="{TemplateBinding ViewportHeight}"
                                                       Maximum="{TemplateBinding ScrollableHeight}"
                                                       Minimum="0"
                                                       Value="{TemplateBinding VerticalOffset}"
                                                       Margin="0,-1,-1,-1"/>

                                            <ScrollBar x:Name="HorizontalScrollBar" Height="18"
                                                       IsTabStop="False"
                                                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                                       Grid.Column="0" Grid.Row="1" Orientation="Horizontal"
                                                       ViewportSize="{TemplateBinding ViewportWidth}"
                                                       Maximum="{TemplateBinding ScrollableWidth}"
                                                       Minimum="0"
                                                       Value="{TemplateBinding HorizontalOffset}"
                                                       Margin="-1,0,-1,-1"/>

                                        </Grid>
                                    </Border>
                                </ControlTemplate>
                            </ScrollViewer.Template>
                            <ItemsPresenter />
                        </ScrollViewer>
                    </Border>-->
              <Grid>
                <VisualStateManager.VisualStateGroups>
                  <VisualStateGroup x:Name="ValidationStates">
                    <VisualState x:Name="Valid"/>
                    <VisualState x:Name="InvalidUnfocused">
                      <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                          <DiscreteObjectKeyFrame KeyTime="0">
                            <DiscreteObjectKeyFrame.Value>
                              <Visibility>Visible</Visibility>
                            </DiscreteObjectKeyFrame.Value>
                          </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                      </Storyboard>
                    </VisualState>
                    <VisualState x:Name="InvalidFocused">
                      <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility">
                          <DiscreteObjectKeyFrame KeyTime="0">
                            <DiscreteObjectKeyFrame.Value>
                              <Visibility>Visible</Visibility>
                            </DiscreteObjectKeyFrame.Value>
                          </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen">
                          <DiscreteObjectKeyFrame KeyTime="0">
                            <DiscreteObjectKeyFrame.Value>
                              <System:Boolean>True</System:Boolean>
                            </DiscreteObjectKeyFrame.Value>
                          </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                      </Storyboard>
                    </VisualState>
                  </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
                  <ScrollViewer x:Name="ScrollViewer" Background="{TemplateBinding Background}" BorderBrush="Transparent" BorderThickness="0" Padding="{TemplateBinding Padding}" TabNavigation="{TemplateBinding TabNavigation}">
                    <ItemsPresenter/>
                  </ScrollViewer>
                </Border>
                <Border x:Name="ValidationErrorElement" Visibility="Collapsed" BorderBrush="#FFDB000C" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
                  <ToolTipService.ToolTip>
                    <ToolTip x:Name="validationTooltip" Template="{StaticResource ValidationToolTipTemplate}" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                      <ToolTip.Triggers>
                        <EventTrigger RoutedEvent="Canvas.Loaded">
                          <BeginStoryboard>
                            <Storyboard>
                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                  <DiscreteObjectKeyFrame.Value>
                                    <System:Boolean>true</System:Boolean>
                                  </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                              </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                          </BeginStoryboard>
                        </EventTrigger>
                      </ToolTip.Triggers>
                    </ToolTip>
                  </ToolTipService.ToolTip>
                  <Grid Height="10" HorizontalAlignment="Right" Margin="0,-4,-4,0" VerticalAlignment="Top" Width="10" Background="Transparent">
                    <Path Fill="#FFDC000C" Margin="-1,3,0,0" Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"/>
                    <Path Fill="#ffffff" Margin="-1,3,0,0" Data="M 0,0 L2,0 L 8,6 L8,8"/>
                  </Grid>
                </Border>
              </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>



  <Style TargetType="local:ListBoxItem">
    <Setter Property="Padding" Value="3" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="VerticalContentAlignment" Value="Top" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="TabNavigation" Value="Local" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:ListBoxItem">
          <!--<Grid Background="{TemplateBinding Background}">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="fillColor" Storyboard.TargetProperty="Opacity" Duration="0" To=".35"/>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="Opacity" Duration="0" To=".55" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="SelectionStates">
                                <vsm:VisualState x:Name="Unselected" />
                                <vsm:VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="fillColor2" Storyboard.TargetProperty="Opacity" Duration="0" To=".75"/>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Unfocused"/>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="fillColor" Opacity="0" Fill="#FFBADDE9" IsHitTestVisible="False" RadiusX="1" RadiusY="1"/>
                        <Rectangle x:Name="fillColor2" Opacity="0" Fill="#FFBADDE9" IsHitTestVisible="False" RadiusX="1" RadiusY="1"/>
                        <ContentPresenter
                                x:Name="contentPresenter"
                                Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                HorizontalAlignment="Right"
                                Margin="{TemplateBinding Padding}"/>
                        <Rectangle x:Name="FocusVisualElement" Stroke="#FF6DBDD1" StrokeThickness="1" Visibility="Collapsed" RadiusX="1" RadiusY="1" />
                    </Grid>-->
          <Grid Background="{TemplateBinding Background}">
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="MouseOver">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="fillColor" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value=".35"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="SelectionStates">
                <VisualState x:Name="Unselected"/>
                <VisualState x:Name="Selected">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="fillColor2" Storyboard.TargetProperty="Opacity">
                      <SplineDoubleKeyFrame KeyTime="0" Value=".75"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="FocusStates">
                <VisualState x:Name="Focused">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                      <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                          <Visibility>Visible</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                      </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Unfocused"/>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Rectangle x:Name="fillColor" Fill="#FFBADDE9" RadiusX="1" RadiusY="1" IsHitTestVisible="False" Opacity="0"/>
            <Rectangle x:Name="fillColor2" Fill="#FFBADDE9" RadiusX="1" RadiusY="1" IsHitTestVisible="False" Opacity="0"/>
            <ContentPresenter x:Name="contentPresenter" 
                              HorizontalAlignment="Right" 
                              Margin="{TemplateBinding Padding}" 
                              Content="{TemplateBinding Content}" 
                              ContentTemplate="{TemplateBinding ContentTemplate}"/>
            <Rectangle x:Name="FocusVisualElement" Stroke="#FF6DBDD1" StrokeThickness="1" RadiusX="1" RadiusY="1" Visibility="Collapsed"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!--TabItem-->
  <Style TargetType="local:TabItem">
    <Setter Property="IsTabStop" Value="False"/>
    <Setter Property="Background" Value="#FF1F3B53"/>
    <Setter Property="BorderBrush" Value="#FFA3AEB9"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Padding" Value="6,2,6,2"/>
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="VerticalContentAlignment" Value="Stretch"/>
    <Setter Property="MinWidth" Value="5"/>
    <Setter Property="MinHeight" Value="5"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="local:TabItem">
          <Grid x:Name="Root">
            <vsm:VisualStateManager.VisualStateGroups>
              <vsm:VisualStateGroup x:Name="CommonStates">
                <vsm:VisualStateGroup.Transitions>
                  <vsm:VisualTransition GeneratedDuration="0" />
                  <vsm:VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" />
                </vsm:VisualStateGroup.Transitions>
                <vsm:VisualState x:Name="Normal" />
                <vsm:VisualState x:Name="MouseOver">
                  <Storyboard>
                    <!-- For some reason, it animates all Borders with just this line.
				If I add code for each then it crashes SL. -->
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="BorderTop" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#FF448DCA"/>
                    </ColorAnimationUsingKeyFrames>

                    <!--GradientTop-->
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientTop" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#7FFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientTop" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#CCFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientTop" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#F2FFFFFF"/>
                    </ColorAnimationUsingKeyFrames>

                    <!--GradientBottom-->
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientBottom" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#7FFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientBottom" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#CCFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientBottom" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#F2FFFFFF"/>
                    </ColorAnimationUsingKeyFrames>

                    <!--GradientLeft-->
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientLeft" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#7FFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientLeft" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#CCFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientLeft" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#F2FFFFFF"/>
                    </ColorAnimationUsingKeyFrames>

                    <!--GradientRight-->
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientRight" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#7FFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientRight" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#CCFFFFFF"/>
                    </ColorAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="GradientRight" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                      <SplineColorKeyFrame KeyTime="0" Value="#F2FFFFFF"/>
                    </ColorAnimationUsingKeyFrames>

                    <!--FocusVisual-->
                    <DoubleAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="FocusVisualTop" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="FocusVisualBottom" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="FocusVisualLeft" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="FocusVisualRight" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>

                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Disabled">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualTopSelected" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualTopUnSelected" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualBottomSelected" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualBottomUnSelected" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualLeftSelected" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualLeftUnSelected" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualRightSelected" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualRightUnSelected" Storyboard.TargetProperty="(UIElement.Opacity)">
                      <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
              <vsm:VisualStateGroup x:Name="SelectionStates">
                <vsm:VisualState x:Name="Unselected"/>
                <vsm:VisualState x:Name="Selected" />
              </vsm:VisualStateGroup>
              <vsm:VisualStateGroup x:Name="FocusStates">
                <vsm:VisualState x:Name="Focused">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualTop" Storyboard.TargetProperty="Visibility" Duration="0">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualBottom" Storyboard.TargetProperty="Visibility" Duration="0">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualLeft" Storyboard.TargetProperty="Visibility" Duration="0">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                    </ObjectAnimationUsingKeyFrames>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualRight" Storyboard.TargetProperty="Visibility" Duration="0">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
                <vsm:VisualState x:Name="Unfocused">
                  <Storyboard>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility" Duration="0">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                    </ObjectAnimationUsingKeyFrames>
                  </Storyboard>
                </vsm:VisualState>
              </vsm:VisualStateGroup>
            </vsm:VisualStateManager.VisualStateGroups>

            <!-- TabStripPlacement Top | Selected -->
            <Grid x:Name="TemplateTopSelected" Visibility="Collapsed" Canvas.ZIndex="1">
              <Border
	                              BorderBrush="{TemplateBinding BorderBrush}"
	                              BorderThickness="1,1,1,0" 
	                              Background="{TemplateBinding Background}"
	                              Margin="-2,-2,-2,0"
	                              CornerRadius="3,3,0,0">
                <Border BorderThickness="1" BorderBrush="#FFFFFFFF" CornerRadius="1,1,0,0">
                  <Border.Background>
                    <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                      <GradientStop Color="#FFFFFFFF" Offset="0" />
                      <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                      <GradientStop Color="#E5FFFFFF" Offset="0.625" />
                      <GradientStop Color="#C6FFFFFF" Offset="1" />
                    </LinearGradientBrush>
                  </Border.Background>
                  <Grid>
                    <Rectangle Fill="#FFFFFFFF" Margin="0,0,0,-2" />
                    <ContentControl x:Name="HeaderTopSelected"
				                                                IsTabStop="False"
				                                                Foreground="{TemplateBinding Foreground}" 
				                                                FontSize="{TemplateBinding FontSize}"
				                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
				                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
				                                                Margin="{TemplateBinding Padding}"
				                                                Cursor="{TemplateBinding Cursor}" />
                  </Grid>
                </Border>
              </Border>

              <!--Focus Visual-->
              <Border x:Name="FocusVisualTop" 
                                    CornerRadius="3,3,0,0" 
                                    BorderBrush="#FF6DBDD1" 
                                    BorderThickness="1,1,1,0" 
                                    Margin="-2,-2,-2,0" 
                                    Visibility="Collapsed" 
                                    IsHitTestVisible="false" />
              <Border Margin="-2,-2,-2,0" x:Name="DisabledVisualTopSelected" IsHitTestVisible="false" Opacity="0" 
		                                Background="#8CFFFFFF"  CornerRadius="3,3,0,0" />
            </Grid>

            <!-- TabStripPlacement Top | Unselected -->
            <Grid x:Name="TemplateTopUnselected" Visibility="Collapsed">
              <Border x:Name="BorderTop"
	                                  BorderBrush="{TemplateBinding BorderBrush}"
	                                  BorderThickness="1" 
	                                  Background="{TemplateBinding Background}"
	                                  CornerRadius="3,3,0,0">
                <Border x:Name="GradientTop" BorderThickness="1" BorderBrush="#FFFFFFFF" CornerRadius="1,1,0,0">
                  <Border.Background>
                    <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                      <GradientStop Color="#FFFFFFFF" Offset="0" />
                      <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                      <GradientStop Color="#E5FFFFFF" Offset="0.625" />
                      <GradientStop Color="#C6FFFFFF" Offset="1" />
                    </LinearGradientBrush>
                  </Border.Background>
                  <Grid>
                    <ContentControl x:Name="HeaderTopUnselected"
				                                                IsTabStop="False"
				                                                Foreground="{TemplateBinding Foreground}" 
				                                                FontSize="{TemplateBinding FontSize}"
				                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
				                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
				                                                Margin="{TemplateBinding Padding}"
				                                                Cursor="{TemplateBinding Cursor}" />
                  </Grid>
                </Border>
              </Border>
              <Border x:Name="DisabledVisualTopUnSelected" IsHitTestVisible="false" Opacity="0" 
		                                Background="#8CFFFFFF" CornerRadius="3,3,0,0" />
            </Grid>

            <!-- TabStripPlacement Bottom | Selected -->
            <Grid x:Name="TemplateBottomSelected" Visibility="Collapsed" Canvas.ZIndex="1">
              <Border
	                                  BorderBrush="{TemplateBinding BorderBrush}"
	                                  BorderThickness="1,0,1,1" 
	                                  Background="{TemplateBinding Background}"
	                                  Margin="-2,0,-2,-2"
	                                  CornerRadius="0,0,3,3">
                <Border BorderThickness="1" BorderBrush="#FFFFFFFF" CornerRadius="0,0,1,1">
                  <Border.Background>
                    <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                      <GradientStop Color="#FFFFFFFF" Offset="0" />
                      <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                      <GradientStop Color="#E5FFFFFF" Offset="0.625" />
                      <GradientStop Color="#C6FFFFFF" Offset="1" />
                    </LinearGradientBrush>
                  </Border.Background>
                  <Grid>
                    <Rectangle Fill="#FFFFFFFF" Margin="0,-2,0,0" />
                    <ContentControl x:Name="HeaderBottomSelected"
				                                                IsTabStop="False"
				                                                Foreground="{TemplateBinding Foreground}" 
				                                                FontSize="{TemplateBinding FontSize}"
				                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
				                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
				                                                Margin="{TemplateBinding Padding}"
				                                                Cursor="{TemplateBinding Cursor}" />
                  </Grid>
                </Border>
              </Border>

              <!--Focus Visual-->
              <Border x:Name="FocusVisualBottom" 
		                                CornerRadius="0,0,3,3" 
		                                BorderBrush="#FF6DBDD1" 
		                                BorderThickness="1,0,1,1" 
		                                Margin="-2,0,-2,-2"
		                                Visibility="Collapsed" 
		                                IsHitTestVisible="false" />
              <Border Margin="-2,0,-2,-2" x:Name="DisabledVisualBottomSelected" IsHitTestVisible="false" Opacity="0" 
		                                Background="#8CFFFFFF" CornerRadius="0,0,3,3" />
            </Grid>

            <!-- TabStripPlacement Bottom + Unselected -->
            <Grid x:Name="TemplateBottomUnselected" Visibility="Collapsed">
              <Border x:Name="BorderBottom"
	                                  BorderBrush="{TemplateBinding BorderBrush}"
	                                  BorderThickness="1" 
	                                  Background="{TemplateBinding Background}"
	                                  CornerRadius="0,0,3,3">
                <Border x:Name="GradientBottom" BorderThickness="1" BorderBrush="#FFFFFFFF" CornerRadius="0,0,1,1">
                  <Border.Background>
                    <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                      <GradientStop Color="#FFFFFFFF" Offset="0" />
                      <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                      <GradientStop Color="#E5FFFFFF" Offset="0.625" />
                      <GradientStop Color="#C6FFFFFF" Offset="1" />
                    </LinearGradientBrush>
                  </Border.Background>
                  <Grid>
                    <ContentControl x:Name="HeaderBottomUnselected"
				                                                IsTabStop="False"
				                                                Foreground="{TemplateBinding Foreground}" 
				                                                FontSize="{TemplateBinding FontSize}"
				                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
				                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
				                                                Margin="{TemplateBinding Padding}"
				                                                Cursor="{TemplateBinding Cursor}" />
                  </Grid>
                </Border>
              </Border>
              <Border x:Name="DisabledVisualBottomUnSelected" IsHitTestVisible="false" Opacity="0" 
		                                Background="#8CFFFFFF" CornerRadius="0,0,3,3" />
            </Grid>

            <!-- TabStripPlacement Left | Selected -->
            <Grid x:Name="TemplateLeftSelected" Visibility="Collapsed" Canvas.ZIndex="1">
              <Border
	                                  BorderBrush="{TemplateBinding BorderBrush}"
	                                  BorderThickness="1,1,0,1" 
	                                  Background="{TemplateBinding Background}"
	                                  Margin="-2,-2,0,-2"
	                                  CornerRadius="3,0,0,3">
                <Border BorderThickness="1" BorderBrush="#FFFFFFFF" CornerRadius="1,0,0,1">
                  <Border.Background>
                    <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                      <GradientStop Color="#FFFFFFFF" Offset="0" />
                      <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                      <GradientStop Color="#E5FFFFFF" Offset="0.625" />
                      <GradientStop Color="#C6FFFFFF" Offset="1" />
                    </LinearGradientBrush>
                  </Border.Background>
                  <Grid>
                    <Rectangle Fill="#FFFFFFFF" Margin="0,0,-2,0" />
                    <ContentControl x:Name="HeaderLeftSelected"
				                                                IsTabStop="False"
				                                                Foreground="{TemplateBinding Foreground}" 
				                                                FontSize="{TemplateBinding FontSize}"
				                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
				                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
				                                                Margin="{TemplateBinding Padding}"
				                                                Cursor="{TemplateBinding Cursor}" />
                  </Grid>
                </Border>
              </Border>

              <!--Focus Visual-->
              <Border x:Name="FocusVisualLeft" 
		                                CornerRadius="3,0,0,3" 
		                                BorderBrush="#FF6DBDD1" 
		                                BorderThickness="1,1,0,1" 
		                                Margin="-2,-2,0,-2"
		                                Visibility="Collapsed" 
		                                IsHitTestVisible="false" />
              <Border Margin="-2,-2,0,-2" x:Name="DisabledVisualLeftSelected" IsHitTestVisible="false" Opacity="0" 
		                                Background="#8CFFFFFF" CornerRadius="3,0,0,3" />
            </Grid>

            <!-- TabStripPlacement Left | Unselected -->
            <Grid x:Name="TemplateLeftUnselected" Visibility="Collapsed">
              <Border x:Name="BorderLeft"
	                                  BorderBrush="{TemplateBinding BorderBrush}"
	                                  BorderThickness="{TemplateBinding BorderThickness}" 
	                                  Background="{TemplateBinding Background}"
	                                  CornerRadius="3,0,0,3">
                <Border x:Name="GradientLeft" BorderThickness="1" BorderBrush="#FFFFFFFF" CornerRadius="1,0,0,1">
                  <Border.Background>
                    <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                      <GradientStop Color="#FFFFFFFF" Offset="0" />
                      <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                      <GradientStop Color="#E5FFFFFF" Offset="0.625" />
                      <GradientStop Color="#C6FFFFFF" Offset="1" />
                    </LinearGradientBrush>
                  </Border.Background>
                  <Grid>
                    <ContentControl x:Name="HeaderLeftUnselected"
				                                                IsTabStop="False"
				                                                Foreground="{TemplateBinding Foreground}" 
				                                                FontSize="{TemplateBinding FontSize}"
				                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
				                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
				                                                Margin="{TemplateBinding Padding}"
				                                                Cursor="{TemplateBinding Cursor}" />
                  </Grid>
                </Border>
              </Border>
              <Border x:Name="DisabledVisualLeftUnSelected" IsHitTestVisible="false" Opacity="0" 
		                                Background="#8CFFFFFF" CornerRadius="3,0,0,3" />
            </Grid>

            <!-- TabStripPlacement Right | Selected -->
            <Grid x:Name="TemplateRightSelected" Visibility="Collapsed" Canvas.ZIndex="1">
              <Border
	                                  BorderBrush="{TemplateBinding BorderBrush}"
	                                  BorderThickness="0,1,1,1" 
	                                  Background="{TemplateBinding Background}"
	                                  Margin="0,-2,-2,-2"
	                                  CornerRadius="0,3,3,0">
                <Border BorderThickness="1" BorderBrush="#FFFFFFFF" CornerRadius="0,1,1,0">
                  <Border.Background>
                    <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                      <GradientStop Color="#FFFFFFFF" Offset="0" />
                      <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                      <GradientStop Color="#E5FFFFFF" Offset="0.625" />
                      <GradientStop Color="#C6FFFFFF" Offset="1" />
                    </LinearGradientBrush>
                  </Border.Background>
                  <Grid>
                    <Rectangle Fill="#FFFFFFFF" Margin="-2,0,0,0" />
                    <ContentControl x:Name="HeaderRightSelected"
				                                                IsTabStop="False"
				                                                Foreground="{TemplateBinding Foreground}" 
				                                                FontSize="{TemplateBinding FontSize}"
				                                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
				                                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
				                                                Margin="{TemplateBinding Padding}"
				                                                Cursor="{TemplateBinding Cursor}" />
                  </Grid>
                </Border>
              </Border>

              <!--Focus Visual-->
              <Border x:Name="FocusVisualRight" 
		                                CornerRadius="0,3,3,0" 
		                                BorderBrush="#FF6DBDD1" 
		                                BorderThickness="0,1,1,1" 
		                                Margin="0,-2,-2,-2" 
		                                Visibility="Collapsed" 
		                                IsHitTestVisible="false" />
              <Border Margin="0,-2,-2,-2" x:Name="DisabledVisualRightSelected" IsHitTestVisible="false" Opacity="0" 
		                                Background="#8CFFFFFF" CornerRadius="0,3,3,0" />
            </Grid>

            <!-- TabStripPlacement Right + Unselected -->
            <Grid x:Name="TemplateRightUnselected" Visibility="Collapsed">
              <Border x:Name="BorderRight"
	                                  BorderBrush="{TemplateBinding BorderBrush}"
	                                  BorderThickness="1" 
	                                  Background="{TemplateBinding Background}"
	                                  CornerRadius="0,3,3,0">
                <Border x:Name="GradientRight" BorderThickness="1" BorderBrush="#FFFFFFFF" CornerRadius="0,1,1,0">
                  <Border.Background>
                    <LinearGradientBrush StartPoint=".7,0" EndPoint=".7,1">
                      <GradientStop Color="#FFFFFFFF" Offset="0" />
                      <GradientStop Color="#F9FFFFFF" Offset="0.375" />
                      <GradientStop Color="#E5FFFFFF" Offset="0.625" />
                      <GradientStop Color="#C6FFFFFF" Offset="1" />
                    </LinearGradientBrush>
                  </Border.Background>
                  <Grid>
                    <ContentControl x:Name="HeaderRightUnselected"
			                                                  IsTabStop="False"
			                                                  Foreground="{TemplateBinding Foreground}" 
			                                                  FontSize="{TemplateBinding FontSize}"
			                                                  HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
			                                                  VerticalAlignment="{TemplateBinding VerticalAlignment}"
			                                                  Margin="{TemplateBinding Padding}"
			                                                  Cursor="{TemplateBinding Cursor}" />
                  </Grid>
                </Border>
              </Border>
              <Border x:Name="DisabledVisualRightUnSelected" IsHitTestVisible="false" Opacity="0" 
		                                Background="#8CFFFFFF" CornerRadius="0,3,3,0"/>
            </Grid>

            <Border x:Name="FocusVisualElement" CornerRadius="3,3,0,0" BorderBrush="#FF6DBDD1" BorderThickness="1" Margin="-1" Visibility="Collapsed" IsHitTestVisible="false" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>
